cmake_minimum_required(VERSION 2.8.12)

project(dbmysql LANGUAGES C CXX)

add_library(uhp_mysql SHARED
    dbsqlca.cpp
    dbutil.cpp
    mysqldb.cpp
)

add_executable( uhp_mysql_test
    test.cpp
)
find_library( mysqlclient 
	NAME mysqlclient mariadbclient
	PATHS
	/usr/lib64/mysql/
	/usr/lib64/
	/usr/lib/
	/usr/lib/mysql/
	/usr/lib/x86_64-linux-gnu/
)


target_include_directories(uhp_mysql PUBLIC /usr/include/mysql  /usr/include/mariadb ${PROJECT_ROOT_DIR}/src/dbmysql)
target_include_directories(uhp_mysql_test PRIVATE /usr/include/mysqlclient /usr/include/mariadb ${PROJECT_ROOT_DIR}/src/dbmysql)


target_link_libraries(uhp_mysql PRIVATE ${mysqlclient} uhp_util  pthread)
target_link_libraries(uhp_mysql_test PRIVATE uhp_mysql uhp_util pthread ssl)


install(TARGETS uhp_mysql_test  DESTINATION bin)
install(TARGETS uhp_mysql  DESTINATION lib)
